package com.generalaj.console.compress.tar;

import java.io.BufferedOutputStream;
import java.io.File;

import com.generalaj.console.compress.AbstractArchiveCreator;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;

public class ZipCreator extends AbstractArchiveCreator<ZipArchiveOutputStream, ZipArchiveEntry> {

    public ZipCreator(File archiveFile) {
        super(archiveFile);
    }

    @Override
    protected ZipArchiveEntry createArchiveEntry(String name, File file) {
        ZipArchiveEntry entry=new ZipArchiveEntry(name);
        entry.setSize(file.length());
        return entry;
    }

    @Override
    protected ZipArchiveOutputStream createArchiveOutputStream(BufferedOutputStream stream) {
        return new ZipArchiveOutputStream(stream);
    }
}
